import ajax from '@/lib/Ajax'
import {ApiResponse, LoginInfo, SystemInfo} from "@/lib/types";

export default {

    /**
     * 获取系统信息
     */
    async getSystemInfo(): Promise<SystemInfo> {
        return await ajax.get('/info');
    },

    /**
     * 获取系统信息
     */
    async getLoginInfo(): Promise<LoginInfo> {
        return await ajax.get('/loginInfo');
    },

    /**
     * 执行用户登录请求
     *
     * @param form 登录表单
     */
    async login(form: { username: string, password: string }): Promise<ApiResponse> {
        return await ajax.post('/login', form);
    },

    /**
     * 登出
     */
    async logout(): Promise<ApiResponse> {
        return await ajax.post('/logout', null);
    }

}